package fun.xinnix.controller;

import cn.hutool.http.HttpStatus;
import fun.xinnix.commons.Result;
import fun.xinnix.service.IotService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("/led")
@RestController
public class IotController {
    @Resource
    IotService iotService;

    @PostMapping("/control")
    public ResponseEntity<?> control(Boolean status) {
        iotService.controlLed(status);
        Result result = new Result();
        result.setMsg("成功");
        result.setCode(HttpStatus.HTTP_OK);
        return ResponseEntity.ok().body(result);
    }
}
